################ALGORITHM################
# Strategy defines the algorithm to use
# Olaf is similar to the classical spectral peak algo
# Panako is similar to the algorithm described in the panako paper
# OLAF|PANAKO
STRATEGY=OLAF

# Maximum number of items returned for a query
# Normally only a handful of matches are expected
# So use a large number (> 50) to return all results
# Use 1 if you only want the best ranked result 
NUMBER_OF_QUERY_RESULTS=1000

################Performance################
# The number of processors available 
# to Panako. If zero (or less) all 
# available processor cores are used.
# By default, only a single CPU core is used.
# This makes debugging easier.
# If you want a significant speed-up, set this to zero
AVAILABLE_PROCESSORS=1

################Input################
# The maximum file size (in MB) of files 
# that are stored. The default is 6000 megabytes.
MAX_FILE_SIZE=6000
# Checks the data store if the file
# is already added. Set this to false
# if a large number of unique files are added
# for a small performance gain.
CHECK_DUPLICATE_FILE_NAMES=TRUE

################Monitor################
# The step size while monitoring a long 
# audio fragment, in seconds.
MONITOR_STEP_SIZE=10
# The overlap, also in seconds.
# By default detection resolution
# is 25-5=20 seconds.
MONITOR_OVERLAP=5


################Olaf################
# Determines whether fingerprints are also
# cached to a file for each audio item processed
# For example for de-duplication every audio item 
# is stored and afterwards used as a query, so caching
# the fingerprints will speed up the query process 
OLAF_CACHE_TO_FILE=FALSE
# The folder to cache fingerprints to, if cache to file
# is true
OLAF_CACHE_FOLDER=~/.panako/dbs/olaf_cache"

# The storage to use.
# Either an in memory hasmap is used 
# and nothing is written to disk, or
# the LMDB key-value store is used
# LMDB|MEM
OLAF_STORAGE=LMDB

# The folder to store the LMDB data,
# Preferably this is on a fast SSD
OLAF_LMDB_FOLDER=~/.panako/dbs/olaf_db

# The audio block configuration,
# This determines the size of the time bins (12)
# OLAF_STEP_SIZE (in samples) /OLAF_SAMPLE_RATE s
# And the frequency bin size and max frequency bin
# Sample rate in Hz
OLAF_SAMPLE_RATE=16000
# Audio block size in audio samples
OLAF_SIZE=1024
# Audio step size, in audio samples
OLAF_STEP_SIZE=128

# The query range determines how much time bin info may
# differ between two matching prints
# It acts as a near-exact-hash and copes with
# time bins which are off-by-one, two or the configured value
OLAF_QUERY_RANGE=2

# Determines when matches are accepted.
# At least this amount of fingerprints need to match	
OLAF_MIN_HITS_UNFILTERED=10
# At least this amount of aligned fingerprints need to match	
# before it is accepted as match
OLAF_MIN_HITS_FILTERED=5
# The min and max time factor: the accepted
# matches are expected to be between 
# 95% and 105% of the original speed
OLAF_MIN_TIME_FACTOR=0.95
OLAF_MAX_TIME_FACTOR=1.05

# The fraction of seconds that should have
# matches between reference and query
OLAF_MIN_SEC_WITH_MATCH=0.2

# A match is only counted if
# more than x seconds are matching 
OLAF_MIN_MATCH_DURATION=3



# Event point extraction configuration
# In frequency bins
OLAF_FREQ_MAX_FILTER_SIZE=103
# In time bins
OLAF_TIME_MAX_FILTER_SIZE=25

# Fingerprint construction configuration
# Min and max freq bin distance
OLAF_FP_MIN_FREQ_DIST=1
OLAF_FP_MAX_FREQ_DIST=128
# Min and max time bin distance
OLAF_FP_MIN_TIME_DIST=2
OLAF_FP_MAX_TIME_DIST=33

################Panako################

#Event point filter settings
PANAKO_FREQ_MAX_FILTER_SIZE=103
PANAKO_TIME_MAX_FILTER_SIZE=25

PANAKO_FP_MIN_FREQ_DIST=1
PANAKO_FP_MAX_FREQ_DIST=128
PANAKO_FP_MIN_TIME_DIST=2
PANAKO_FP_MAX_TIME_DIST=33

#audio dispatcher config
PANAKO_AUDIO_BLOCK_SIZE=8192
PANAKO_AUDIO_BLOCK_OVERLAP=0
PANAKO_SAMPLE_RATE=16000

#Spectral tranform configuration
#min frequency =Hz)
PANAKO_TRANSF_MIN_FREQ=110
#max frequency =Hz 6 octaves above 110Hz
PANAKO_TRANSF_MAX_FREQ=7040
#reference frequency =Hz determines bin bin centers
PANAKO_TRANSF_REF_FREQ=440
#bins for each octave
PANAKO_TRANSF_BANDS_PER_OCTAVE=85
#audio samples at 16kHz
PANAKO_TRANSF_TIME_RESOLUTION=128

#query config
PANAKO_QUERY_RANGE=2

PANAKO_MIN_HITS_UNFILTERED=10
PANAKO_MIN_HITS_FILTERED=5
PANAKO_MIN_TIME_FACTOR=0.8
PANAKO_MAX_TIME_FACTOR=1.2
PANAKO_MIN_FREQ_FACTOR=0.8
PANAKO_MAX_FREQ_FACTOR=1.2
# The fraction of seconds that should have
# matches between reference and query
PANAKO_MIN_SEC_WITH_MATCH=0.2

# A match is only counted if
# more than x seconds are matching 
PANAKO_MIN_MATCH_DURATION=3


# The storage to use: MEM|LMDB
# Stands for Memory, files on disk or the LMDB key-value store
PANAKO_STORAGE=LMDB
PANAKO_LMDB_FOLDER=~/.panako/dbs/panako_db
PANAKO_CACHE_FOLDER=~/.panako/dbs/panako_cache
PANAKO_CACHE_TO_FILE=TRUE
PANAKO_USE_CACHED_PRINTS=TRUE


################Decoder################
# Decoding is done via a sub process of which the output
# is piped into Panako. The pipe should
# provide raw PCM, 16000Hz, 16bit.  
# To be able to use the pipe, libav, ffmpeg
# or a similar tool needs to be installed.
# Decoding using such library is fast,
# more robust, well supported, and has 
# support for various audio formats.
#
# Alternatively you can use JAVA but then
# The audio needs to be in the excpected format 
# and sample rate.
#(JAVA|PIPE)
DECODER=PIPE
DECODER_PIPE_BUFFER_SIZE=44100
DECODER_PIPE_COMMAND=ffmpeg -hide_banner -loglevel panic -ss %input_seeking%  %number_of_seconds% -i "%resource%" -vn -ar %sample_rate% -ac %channels% -f s16le -acodec pcm_s16le pipe\:1
DECODER_PIPE_ENVIRONMENT=/bin/bash
DECODER_PIPE_ENVIRONMENT_ARG=-c
DECODER_PIPE_LOG_FILE=decoder_log.txt
